<template xmlns="http://www.w3.org/1999/html">
  <div class="app-container">
    <el-descriptions class="margin-top"  :column="2"  border>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          活动名称
        </template>
        {{form.promotionName}}
      </el-descriptions-item>
      <el-descriptions-item >
        <template slot="label">
          <i class="el-icon-office-building"></i>
          活动时间
        </template>
        {{form.startTime}} - {{form.endTime}}
      </el-descriptions-item>
      <el-descriptions-item >
        <template slot="label">
          <i class="el-icon-office-building"></i>
          活动类型
        </template>
        <el-radio-group v-model="form.discountType" disabled>
          <el-radio-button label="FULL_MINUS">满减</el-radio-button>
          <el-radio-button label="FULL_RATE">满折</el-radio-button>
        </el-radio-group>
      </el-descriptions-item>
      <el-descriptions-item >
        <template slot="label">
          <i class="el-icon-office-building"></i>
          优惠门槛
        </template>
        消费 {{form.fullMoney}} 元，可参与优惠
      </el-descriptions-item>

      <el-descriptions-item >
        <template slot="label">
          <i class="el-icon-office-building"></i>
          活动描述
        </template>
        {{form.description}}
      </el-descriptions-item>


      <el-descriptions-item  v-if="form.discountType == 'FULL_MINUS'">
        <template slot="label">
          <i class="el-icon-office-building"></i>
          优惠金额
        </template>
        {{form.fullMinus}} 元
      </el-descriptions-item>

      <el-descriptions-item  v-if="form.discountType == 'FULL_RATE'">
        <template slot="label">
          <i class="el-icon-office-building"></i>
          优惠折扣
        </template>
        {{form.fullRate}} 折
      </el-descriptions-item>

      <el-descriptions-item  >
        <template slot="label">
          <i class="el-icon-office-building"></i>
          额外赠送
        </template>
        <el-checkbox v-model="form.freeFreightFlag" :true-label=1 :false-label=0 disabled>免邮费</el-checkbox>
        <el-checkbox v-model="form.couponFlag" :true-label=1 :false-label=0 disabled>送优惠券</el-checkbox>
        <el-checkbox v-model="form.giftFlag" :true-label=1 :false-label=0 disabled>送赠品</el-checkbox>
        <el-checkbox v-model="form.pointFlag" :true-label=1 :false-label=0 disabled>送积分</el-checkbox>
      </el-descriptions-item>

      <el-descriptions-item  v-if="form.couponFlag == '1'">
        <template slot="label">
          <i class="el-icon-office-building"></i>
          赠送优惠券
        </template>
        {{coupon.couponName}}
      </el-descriptions-item>

      <el-descriptions-item  v-if="form.giftFlag == '1'">
        <template slot="label">
          <i class="el-icon-office-building"></i>
          赠品
        </template>
        {{gift.goodsName}}
      </el-descriptions-item>

      <el-descriptions-item  v-if="form.pointFlag == '1'">
        <template slot="label">
          <i class="el-icon-office-building"></i>
          赠积分
        </template>
        {{form.point}}
      </el-descriptions-item>

      <el-descriptions-item >
        <template slot="label">
          <i class="el-icon-office-building"></i>
          使用范围
        </template>
        <el-radio-group v-model="form.scopeType" disabled>
          <el-radio-button label="ALL">全品类</el-radio-button>
          <el-radio-button label="PORTION_GOODS">指定商品</el-radio-button>
        </el-radio-group>
      </el-descriptions-item>
    </el-descriptions>
    <el-card class="box-card" style="margin-top: 20px" v-if="form.scopeType == 'PORTION_GOODS'">
      <div slot="header" class="clearfix">
        <span>指定商品</span>
      </div>
      <div class="form-item-view">
        <el-table  :data="promotionGoodsList" >
          <el-table-column label="商品名称" align="center" prop="goodsName" />
          <el-table-column label="商品价格" align="center" prop="price" />
          <el-table-column label="库存" align="center" prop="quantity" />
        </el-table>

      </div>
    </el-card>
  </div>
</template>

<script>
import {  getFullDiscount } from "@/api/mall/promotion/full-discount";
export default {
  name: "FullDiscountView",
  dicts: ['mall_coupon_get_type','mall_coupon_type','mall_coupon_scope_type'],
  props: {
    activityId: {
      type: String
    }
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 查询参数
      // 表单参数
      form: {
        freeFreightFlag: 1
      },
      coupon: [], //选择的优惠券列表
      gift: [], //选择的会员列表
      promotionGoodsList: []
    };
  },
  created() {
    this._getFullDiscount();
  },
  methods: {
    /** 查询商城满减活动详情 */
    _getFullDiscount() {
      getFullDiscount(this.activityId).then(response => {
        this.form = response.data.fullDiscount;
        this.coupon = response.data.coupon;
        this.gift = response.data.gift;
        this.promotionGoodsList = response.data.promotionGoodsList
      });
    },
  }
};
</script>
